<template>
    <view>
        <custom :float="true"></custom>
        <view style="height: 750rpx;">
            <image style="width: 750rpx; height: 750rpx;" :src="page.banner | ossUrl(750)"></image>
        </view>
        <view class="padding-20 bg-white">
            <view class="flex padding-bottom-20">
                <view style="height:240rpx;">
                    <image class="radius-10" style="width: 260rpx; height:260rpx;" :src="page.logo | ossUrl(260)"></image>
                </view>
                <view class="margin-left-20 flex flex-direction justify-between">

                    <view class="text-lg text-bold text-cut-2" style="width: 410rpx;">{{page.name}}</view>
                    <view class="text-gray text-13 margin-top-16 text-cut-2" style="width: 410rpx;">{{page.content}}</view>
                    <view class="text-gray text-13 margin-top-14">
                        <view class="cu-tag bg-nddyny" v-if="page.gift_type == 0">区域代理</view>
                        <view class="cu-tag bg-nddyny" v-if="page.gift_type == 1">城市合伙人</view>
                        <view class="cu-tag" v-if="page.limit_amount_only > 0">永久限购次数
                            {{page.limit_amount_only}}</view>
                    </view>
                    <view class="text-gray text-13 margin-top-14">
                        奖励
                        <text class="margin-left-10" v-if="page.reward_amount > 0">
                            推广额度 {{page.reward_amount | floor}}
                        </text>
                        <text class="margin-left-10" v-if="page.reward_gold_share_amount > 0">
                            金股数量 {{page.reward_gold_share_amount | floor}}
                        </text>
                    </view>
                    <view class="text-nddyny text-bold margin-top-10">
                        <text>￥</text>
                        <text class="text-xl">{{page.price | floor}}</text>
                    </view>
                </view>
            </view>
            <nFormButton title="立即购买" :uri="'/user/pay/promoteGift?gift_id='+data.form.gift_id"></nFormButton>
        </view>
        <nBar title="详情" style="margin-top: -20rpx"></nBar>
        <image v-if="page.album_1" :src="page.album_1 | ossUrl(750)" class="width-100p" mode="widthFix"></image>
        <image v-if="page.album_2" :src="page.album_2 | ossUrl(750)" class="width-100p" mode="widthFix"></image>
        <image v-if="page.album_3" :src="page.album_3 | ossUrl(750)" class="width-100p" mode="widthFix"></image>
        <image v-if="page.album_4" :src="page.album_4 | ossUrl(750)" class="width-100p" mode="widthFix"></image>
        <image v-if="page.album_5" :src="page.album_5 | ossUrl(750)" class="width-100p" mode="widthFix"></image>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                data: {
                    form: {
                        gift_id: null
                    }
                },
                page: {
                    album_1: '',
                    album_2: '',
                    album_3: '',
                    album_4: '',
                    album_5: '',
                    attr: '',
                    banner: '',
                    content: '',
                    gift_type: '',
                    limit_amount_only: '',
                    logo: '',
                    name: '',
                    price: '',
                    reward_amount: '',
                    reward_gold_share_amount: '',
                }
            }
        },
        onLoad(params) {
            if (!params.gift_id) {
                this.$store.commit('userReTo', '/user/promote/gift/list');
                return
            }
            this.data.form.gift_id = params.gift_id;
            this.pageInit();
        },
        methods: {
            pageInit(action) {
                this.$api.post(this, {
                    url: '/user/PromoterGift/info',
                    success: (Result) => {
                        if (this.$api.form.toast(this, Result)) return;
                        this.page = Result.result;
                    }
                });
            }
        }
    }
</script>
